diff -upr mesa-22.3.7/meson.build mesa-22.3.7.patch/meson.build
--- mesa-22.3.7/meson.build	2023-03-08 18:37:09.000000000 +0000
+++ mesa-22.3.7.patch/meson.build	2023-05-03 05:50:17.658243174 +0000
@@ -1434,21 +1434,6 @@ foreach f, prefix: functions_to_detect
 endforeach
 
 if cpp.links('''
-    #define _GNU_SOURCE
-    #include <stdlib.h>
-
-    static int dcomp(const void *l, const void *r, void *t) { return 0; }
-
-    int main(int ac, char **av) {
-      int arr[] = { 1 };
-      void *t = NULL;
-      qsort_r((void*)&arr[0], 1, 1, dcomp, t);
-      return (0);
-    }''',
-    args : pre_args,
-    name : 'GNU qsort_r')
-  pre_args += '-DHAVE_GNU_QSORT_R'
-elif cpp.links('''
     #include <stdlib.h>
 
     static int dcomp(void *t, const void *l, const void *r) { return 0; }
